package com.wen.config;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.Properties;


// 读取配置文件
public class Config implements Serializable {
    private Properties properties;

    public Config(String path){
        InputStreamReader fileReader = null;
        try {
            properties = new Properties();
            fileReader = new InputStreamReader(Config.class.getResourceAsStream(path));
            properties.load(fileReader);
        } catch (Exception ignored) {
        }finally {
            if (fileReader != null) {
                try {
                    fileReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }


    public String get(String key){
        return properties.getProperty(key);
    }
}
